local MainScene = class("MainScene",cc.Scene )

function MainScene:ctor()
    self:addChild(self:createLayer())
end

local function changescene_callback()
    local gameGame = require("GameScene"):create()
    cc.Director:getInstance():replaceScene(gameGame)
end


function MainScene:createLayer()
    cclog("MainScene init")
    local layer = cc.Layer:create()


    --菜单背景
    local sprite = cc.Sprite:create("images/menu_bg.jpg")
    sprite:setPosition(cc.p(display.center ))
    sprite:setContentSize(display.height * 9 / 16, display.height)
    layer:addChild(sprite , BackGroundLevel)

    local start_label = cc.Label:createWithTTF("Start Game", "fonts/Marker Felt.ttf", 35)
    start_label:setTextColor(cc.RED);

    local start_menu_item = cc.MenuItemLabel:create(start_label)
    start_menu_item:registerScriptTapHandler(changescene_callback)
    start_menu_item:setPosition(cc.p(display.center))

    local menu = cc.Menu:createWithItem(start_menu_item)
    menu:setPosition(cc.p(display.left_bottom))

    layer:addChild(menu,GameBoardLevel)

    return layer
end

return MainScene
